package com.cws.enmu;

/**
 * @title [错误码定义]
 * @description [一句话描述]
 * @copyright Copyright 2013 SHIPING INFO Corporation. All rights reserved.
 * @company SHIPING INFO.
 * @author Caspar Du
 * @version v 1.0
 * @create 2013-6-9 下午10:53:28
 */
public enum RspCode {

	SUCCESS("S000", "SUCCESS"),

	// 错误类型定义
	AUTH_FAILED("E101", "Authentication failure."),

	INVALID_TOKENID("E102", "Invalid tokenId."),

	INNER_ERROR("E103", "Inner Error."),

	PARAMERTER_ERROR("E104", "Paramerter Error."),

	OBJECE_NOT_EXIST("E105", "the object not exists."),
	
	JSON_CONVERT_ERROR("E106", "json convert error."),

	OLD_ADMIN_PWD_ERROR("E107", "old admin pwd error."),
	
	ENCRYPT_ERROR("E108", "encrypt error."),
	
	FILE_NOT_EXIST("E109", "file not exist.");



	private final String code;

	private final String description;

	private RspCode(String code, String description) {
		this.code = code;
		this.description = description;
	}

	public String getCode() {
		return code;
	}

	public String getDescription() {
		return description;
	}

	@Override
	public String toString() {
		return code + ": " + description;
	}

	public String toJson() {
		return "{\"code\":\"" + code + "\",\"msg\":\"" + description + "\"}";
	}
}
